﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace T2.Logging.Business
{
    public class EmailService
    {
        public void SendAccountConfirmEmail(string emailTo, string token)
        {
            string path = ConfigurationManager.AppSettings["AccountConfirmEmailLink"].ToString();
            string link = path + "?tk=" + System.Web.HttpUtility.UrlEncode(token);
            string body = "Hi, click <a href='"+link+"'>here</a> to activate your account ";

            EmailHelper email = new EmailHelper();
            email.AddToAddress(emailTo, "User");
            email.Body = body;
            email.Subject = "Account activation";
            email.Send();
        }

        public void SendPasswordResetEmail(string emailTo, string token)
        {
            string path = ConfigurationManager.AppSettings["PasswordResetEmailLink"].ToString();
            string link = path + "?tk=" + HttpUtility.UrlEncode(token);
            string body = "Hi, click <a href='" + link + "'>here</a> to reset your password ";

            EmailHelper email = new EmailHelper();
            email.AddToAddress(emailTo, "User");
            email.Body = body;
            email.Subject = "Password Reset";
            email.Send();
        }

        public void SendPasswordVerificationEmail()
        {
            
        }
    }
}
